<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/index.css" />
		<link rel="stylesheet" type="text/css" href="../../css/order.css"/>
		<title>订单搜索</title>
		<script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<!--<div id="header">
			<div class="header-title" style="position: fixed;top: 0;">
				<img src="../../img/left.png" class="left" />
				<span>订单搜索</span>
			</div>
		</div>-->

		<div class="weui-search-bar" id="searchBar" style="background-color: #efeff4;margin-top: 0;">
			<form class="weui-search-bar__form">
				<div class="weui-search-bar__box">
					<i class="weui-icon-search"></i>
					<input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required="">
					<a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
				</div>
				<label class="weui-search-bar__label" id="searchText">
				      <i class="weui-icon-search"></i>
				      <span>搜索</span>
				</label>
			</form>
			<a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
		</div>
		
		<div class="order-content">
			<ul class="order-list">
				<!--<li>
						<p class="first_p">
							<span>HSGFG6500234982298</span>							
						</p>
						<p class="second_p">
							<span>9340.89  吨</span>
						</p>
						<p class="third_p">
							<span class="time">2017/06/28 10:35:45</span>						
						</p>
						<p class="four_p">
							<span>待提交</span>
						</p>
						<img src="../../img/right.png"/>
					</li>-->
			</ul>
		</div>
		<!--<div class="weui-cells searchbar-result" id="searchResult" style="display:block">
			<div class="weui-cell weui-cell_access">
				<div class="weui-cell__bd weui-cell_primary">
					<p>实时搜索文本</p>
				</div>
			</div>
			<div class="weui-cell weui-cell_access">
				<div class="weui-cell__bd weui-cell_primary">
					<p>实时搜索文本</p>
				</div>
			</div>
			<div class="weui-cell weui-cell_access">
				<div class="weui-cell__bd weui-cell_primary">
					<p>实时搜索文本</p>
				</div>
			</div>
			<div class="weui-cell weui-cell_access">
				<div class="weui-cell__bd weui-cell_primary">
					<p>实时搜索文本</p>
				</div>
			</div>
		</div>-->
		
	</body>
	<script type="text/javascript">
		$(document).ready(function(){
			baseConfig.historyBack()
			$("#searchInput").bind("input propertychange",function(){
				var value = $(this).val()
				$.ajax({
					type: "get",
					url: baseConfig.localHttp+"/api/order/getOrderList",
					async: false,

					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data: {
						clientId: baseConfig.login(),
						pageNumber: 1,
						pageSize: 10,
						searchStr:value
					},
					success: function(data) {
						$.hideLoading();
						if(data.code == 100) {
							$(".order-list").empty()
							var orderList = data.content.orderList
							if(!orderList.length|| orderList.length == data.content.totalCount) {
								$(document.body).destroyInfinite()
								$(".weui-loadmore").html('<div class="weui-loadmore weui-loadmore_line"> <span class="weui-loadmore__tips">暂无数据</span> </div>')
							}
							var li = ""
							for(var i = 0; i < orderList.length; i++) {
								li += "<li status=" + orderList[i]["id"] + "><p class='first_p'>"
								li += "<span>" + orderList[i]["orderNo"] + "</span>"
								li += "</p>"
								li += "<p class='second_p'>"
								li += "<span>" + orderList[i]["materialCount"] + "  吨</span></p>"
								li += "<p class='third_p'>"
								li += "<span class='time'>" + orderList[i]["orderSubmitTimeStr"] + "</span></p>"
								li += "<p class='four_p'><span class='statusColor' style='color:"+baseConfig.colorCode(orderList[i]["fgOrderStatus"])+";border-color:"+baseConfig.colorCode(orderList[i]["fgOrderStatus"])+"'>" + orderList[i]["fgOrderStatusLabel"] + "</span></p>"
								li += "<img src='../../img/right.png'/></li>"
							}
							$(".order-list").append(li)
							
							$(".order-list li").on('click',function(){
								var id = $(this).attr("status")
								var statusColor = $(this).find(".statusColor").html()
								if(statusColor=="待提交"){
									location.href = "../order/waitsubmitOrder.html?orderid="+id
								}else{
									location.href = "../order/orderInformation.html?orderid="+id
								}
							})
						} else {
							$.toptip(data.content, 1200, 'error');
						}
				},
				error:function(data){
					$.hideLoading();
				}
			})
			})
			
		})
	</script>
</html>